/*
 * Copyright (C) 2006 Roman Krashanitsa
 * @author Roman Krashanitsa
 *
 * This file is part of paparazzi.
 *
 * paparazzi is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * paparazzi is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with paparazzi; see the file COPYING.  If not, write to
 * the Free Software Foundation, 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA. 
 *
 */


package pprz;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.TextArea;
import java.awt.Toolkit;

import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JTextArea;

import pprz.components.AcInfoContainer;
import pprz.components.Horizon;
import pprz.components.Map;

public class Run1 {
//	private static HashMap<Integer,Aircraft> acInfo=null;  //there is only one

		
	    /**
	     * Create the GUI and show it.  For thread safety,
	     * this method should be invoked from the
	     * event-dispatching thread.
	     */
	    private static void createAndShowGUI(Link link) {
//	    	acInfo=new HashMap<Integer, Aircraft>();
	    	Toolkit.getDefaultToolkit().setDynamicLayout(true);
	    	//System.setProperty("sun.awt.noerasebackground", "true");
	        //Create and set up the window.
	        boolean resizable = true;
	        boolean closeable = true;
	        boolean maximizable  = true;
	        boolean iconifiable = true;
	        String title = "Frame Title";

	        JDesktopPane frame = new JDesktopPane();
	        JInternalFrame iframe1 = new JInternalFrame(title, resizable, closeable, maximizable, iconifiable);
	        iframe1.setSize(100,100);
	        iframe1.setVisible(true);
	        iframe1.getContentPane().add(new JTextArea());
	        frame.add(iframe1);
	        
	        JInternalFrame iframe3 = new JInternalFrame(title, resizable, closeable, maximizable, iconifiable);
	        iframe3.setSize(100,100);
	        iframe3.setVisible(true);
	        iframe3.getContentPane().add(new JTextArea());
	        frame.add(iframe3);

	        JInternalFrame iframe2 = new JInternalFrame(title, resizable, closeable, maximizable, iconifiable);
	        iframe2.setSize(100,100);
	        iframe2.setVisible(true);
	        iframe2.getContentPane().add(new JTextArea());
	        frame.add(iframe2);

	        TextArea alerts = new TextArea();
			alerts.setEditable(false);
			alerts.setMinimumSize(new Dimension(10, 10));
			alerts.setText("current messages");

			AcInfoContainer acPanel=new AcInfoContainer();
			acPanel.setMinimumSize(new Dimension(10, 10));
			acPanel.setPreferredSize(new Dimension(100, 300));
			acPanel.setLocation(new Point(0, 0));
			acPanel.setSize(new Dimension(100, 300));
			acPanel.setMaximumSize(new Dimension(100, 30000));
			
			Horizon h=new Horizon();
			Map map=new Map(52,8,1000,link.getAircraftList());
			map.setMinimumSize(new Dimension(100,100));
			
			iframe1.getContentPane().add(h);
			iframe2.getContentPane().add(map);
			
			
			//for (int i=0; i<5; i++){
			//		acPanel.add(i);
			//}		
			

	         //Display the window.
//			 Display the desktop in a top-level frame
		    JFrame jframe = new JFrame();
		    jframe.getContentPane().add(frame, BorderLayout.CENTER);
		    jframe.setSize(300, 300);

	         jframe.setVisible(true);
	    }
		
		/**
		 * @param args
		 */
		public static void main(String[] args) {
	        //Schedule a job for the event-dispatching thread:
	        //creating and showing this application's GUI.
	        javax.swing.SwingUtilities.invokeLater(new Runnable() {
	            public void run() {
	                createAndShowGUI(new Link());
	            }
	        });

		}

	}

